import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home/index.vue'
import Address from "../views/Address/index.vue"
import Addaddress from "../views/Addaddress/index.vue"

import routerList from "./routerList"

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/home/main'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:routerList,
    mate:{
      title:'主页'
    }
  },
  {
    path: '/address',
    name: 'Address',
    component: Address,
    mate:{
      title:'地址选择'
    }
  },
  {
    path: '/addaddress',
    name: 'Addaddress',
    component: Addaddress,
    mate:{
      title:'添加地址'
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
